package com.atguigu.gulimall.product;

import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;

public class TimerDemo {


    public static void main(String[] args) throws InterruptedException {
        Timer timer = new Timer();
        /**
         * 参数1：安排的计数任务
         * 参数2：安排计数启动的时间
         * 参数3：安排多久时间执行一次安排的任务
         */
        timer.schedule(new  MayTimerTask(),new Date(121,6,10,11,23,00),3000);
        while(true){
            Thread.sleep(1000);
            System.out.println(new Date());
        }

    }

    static class MayTimerTask extends TimerTask {
        public void run(){
            System.out.println("hello");
        }
    }
}
